package Lee_code;

public class Lee_377_2 {
    public int combinationSum4(int[] nums, int target) {
        //求组合就是先背包后物品
        int len = nums.length;
        int[] dp = new int[target+1];
        for (int i=1; i<=target; i++){
            for (int j=0; j<len; j++){
                if (nums[j]<=i){
                    dp[i] = dp[i] + dp[i-nums[i]];
                }
            }
        }
        return dp[target];
    }
}
